<?php
class sub_menuWidget extends Widget {

	public function render(){
        $action_id = doit::get_action_id();
        
        switch ($action_id) {
            case 'term':
                $term_id = $this->get('id');
                $term_model = $this->model('terms');
                $term_data  = $term_model->find($term_id, array('term_name'));
                echo '<table width="760" border="0" cellspacing="0" cellpadding="0"><tr><td height="30" align="left">分类：' . $term_data['term_name'] . '</td></tr></table>';
                break;
            
            case 'archive':
                $archive_id = $this->get('id');
                echo '<table width="760" border="0" cellspacing="0" cellpadding="0"><tr><td height="30" align="left">存档：' . $archive_id . '</td></tr></table>';
                break;
            
            case 'tag':
                $tag_name = urldecode($this->get('tag_name'));
                echo '<table width="760" border="0" cellspacing="0" cellpadding="0"><tr><td height="30" align="left">标签：' . $tag_name . '</td></tr></table>';
                break;
            
            case 'result':
                $keyword = $this->post('search_keyword') ;
                $keyword = (!$keyword) ? urldecode($this->get('keyword')) : $keyword;
                echo '<table width="760" border="0" cellspacing="0" cellpadding="0"><tr><td height="30" align="left">搜索：“' . $keyword . '”的结果为：</td></tr></table>';
                break;
        }
	}
}